home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / pascal / inlin219.zip / INLINE.DOC < prev    next >
Text File  |  1988-04-26  |  15KB  |  463 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.                                                      April 26, 1988
  9.  
  10.                                 INLINE ASSEMBLER
  11.                                   Version 2.19
  12.  
  13.  
  14.         OVERVIEW
  15.  
  16.         INLINE.EXE is an assembler designed to produce Inline 8086/8088 
  17.         and 8087 code for Turbo Pascal (tm) versions 3 and 4 programs.  
  18.         Like other assemblers, INLINE accepts as input an assembly 
  19.         language source file and produces an object file.  However, in 
  20.         this case, the 'object' file is an ASCII file consisting of 
  21.         Inline statements which may be inserted into the Turbo Pascal 
  22.         program.
  23.  
  24.         Figure 1 illustrates a Pascal function with Inline code generated 
  25.         by INLINE using the source file of Figure 2.
  26.  
  27.  
  28.         LOADING AND RUNNING INLINE
  29.  
  30.         First create an EXE file, INLINE.EXE, by compiling INLINE.PAS 
  31.         using version 4 of the Turbo Pascal compiler.  
  32.  
  33.         INLINE is called at the DOS prompt with two filename parameters 
  34.         specifying the names of the source and object files.  If no 
  35.         extensions are given, .ASM and .OBJ are used by default.  For 
  36.         instance,
  37.  
  38.           INLINE ABC DEF
  39.  
  40.         will cause INLINE to look for a source file, ABC.ASM, and create 
  41.         an object file, DEF.OBJ.  Files with no extension may be input or 
  42.         created by using a simple '.' for the extension.
  43.  
  44.         If the object filename is missing from the command line, an OBJ 
  45.         file will be created using the same name as the source file.  If 
  46.         neither filename is specified, then names will be requested once 
  47.         execution starts.
  48.  
  49.         Once execution begins, INLINE will run to completion with the 
  50.         only console output being error messages.
  51.  
  52.  
  53.         SYNTAX
  54.  
  55.         The appendix lists the mnemonics accepted by INLINE.  Syntax and 
  56.         mnemonics correspond to that used by most assemblers but note 
  57.         should be made of the following:
  58.  
  59.  
  60.  
  61.  
  62.                                    1
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.           1. Turbo Pascal symbols may be used within instruction entries 
  75.              by preceding the symbol with a '>' (16 bit symbol) or a '<' 
  76.              (8 bit symbol).  The characters '+' and '-' are considered 
  77.              part of the symbol.  This allows computations using symbols 
  78.              to be passed on to the compiler where the computation can be 
  79.              made.  For instance, in
  80.  
  81.                  MOV AX,[>SYMBOL+4]       ;'>SYMBOL+4' is passed on
  82.                  MOV AX,[BP+>SYMBOL+4]    ;again '>SYMBOL+4' is passed on
  83.                  MOV AX,>SYMBOL+4[BP]     ;also acceptable
  84.  
  85.              Note that
  86.  
  87.                  MOV AX,[>SYMBOL+4+BP]
  88.  
  89.              is not correct since the wrong instruction will be generated 
  90.              and '>SYMBOL+4+BP' will be passed on.
  91.  
  92.           2. Labels (for use with jump instructions) may be defined 
  93.              simply by appending a ':' to the first item on a line.  
  94.              Avoid using CS:, DS:, ES:, and SS: as labels, as these 
  95.              specify segment overrides.
  96.  
  97.           3. Numerical entries are assumed to be decimal unless preceded 
  98.              by a '$' indicating a hexadecimal entry.  Characters within 
  99.              single quotes may be used for numerical entries as:
  100.  
  101.                  CMP AL,'a'
  102.  
  103.           4. Square brackets are used to indicate 'contents of'.  If no 
  104.              square brackets are used, an immediate operand is assumed.
  105.  
  106.                  MOV AX,[>DATA]  ;Load AX with the contents of DATA.
  107.                  MOV AX,>DATA    ;Load AX with DATA.
  108.  
  109.           5. Instruction prefixes and segment override prefixes may 
  110.              precede the instruction on the same line or may be included 
  111.              on a previous line.  A colon is optional after the segment 
  112.              prefix.
  113.  
  114.                  ES: MOV AX,[1234]    ;ok
  115.                  REPNE MOVSB          ;ok
  116.                  MOV AX,ES:[1234]     ;incorrect syntax for INLINE
  117.  
  118.           6. Comments may be included in the source.  They are delimited 
  119.              by a ';'.
  120.  
  121.           7. Instructions which don't clearly specify the data size 
  122.              require that BYTE PTR, WORD PTR, DWORD PTR, QWORD PTR, or 
  123.              TBYTE PTR be used.  These may be abbreviated by using the 
  124.              first two letters.
  125.  
  126.  
  127.  
  128.                                    2
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.                  INC BYTE PTR [>BDATA]
  141.                  DEC WO >WARRAY[DI]
  142.                  FLD QWORD [>DBL_REAL]
  143.  
  144.           8. JMP instructions may use SHORT, NEAR, or FAR (they should 
  145.              not be abbreviated).  In the absence of one of these words, 
  146.              a SHORT jump will be encoded if the label is already defined 
  147.              and is within range.  If the label is not defined, a NEAR 
  148.              JMP will be encoded unless SHORT is used.
  149.  
  150.              A FAR CALL or JMP may be made to a direct address by stating 
  151.              both the segment and offset separated by a colon.
  152.  
  153.                  CALL FAR $1234:$5678
  154.  
  155.              For Turbo Version 3 only, direct CALL's or JMP's may be made 
  156.              to other Turbo procedures and functions using symbolic 
  157.              names.  The '*' location counter reference is required (not 
  158.              available in version 4) to allow Turbo to determine the 
  159.              correct displacement, as:
  160.  
  161.                  CALL >PROCNAME-*-2
  162.  
  163.              Null JMP's which may be required for delay between port 
  164.              calls on the 80286, may be made as;
  165.  
  166.                  JMP >0        ;or
  167.                  JMP SHORT <0
  168.  
  169.         Normally INLINE generates only one Inline statement per source 
  170.         file.  However, the 'NEW' pseudo-instruction may be used to 
  171.         terminate one Inline statement and begin another.  Using the NEW 
  172.         instruction, it is possible to create a number of Inline 
  173.         statements from one source file.
  174.  
  175.  
  176.         FLOATING POINT INSTRUCTIONS
  177.  
  178.         An automatic WAIT (FWAIT) opcode is generated for each floating 
  179.         point instruction except for the 'no wait' instructions (those 
  180.         with 'N' for the second letter.  However, the WAIT instruction 
  181.         may be required before a floating point instruction having a 
  182.         segment override to insure the WAIT is properly positioned.
  183.  
  184.                WAIT
  185.                ES:FMUL DWORD [BX]
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.                                    3
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.         CAVEATS
  207.  
  208.         INLINE has no way of knowing the value of any symbols used so the 
  209.         user should be especially careful when using the '<' byte size 
  210.         specifier.  A case in point is when referring to stack variables, 
  211.         as:
  212.  
  213.              MOV AX,<ABC[BP]    or
  214.              MOV AX,>ABC[BP]
  215.  
  216.         The use of '<' here will result in saving one byte but will only 
  217.         work correctly if ABC is in the range -128 to 127.  Stack offsets 
  218.         often exceed this in Turbo 4, so it is much safer to use  '>'.
  219.  
  220.         Note that just because a constant is byte size does not make it 
  221.         safe to use '<'.  If ABC were defined as =255, then CMP BX,<ABC 
  222.         would not assemble correctly as a constant in the range -128 to 
  223.         127 would be expected.  Here again, it's safer to use '>'.
  224.  
  225.         Many instructions may be correctly assembled in more than one 
  226.         way.  This has caused some confusion in the past when INLINE 
  227.         produce a byte sequence different from that expected.  When in 
  228.         doubt, check the byte sequence out using DEBUG or run it through 
  229.         UNINLINE for verification.
  230.  
  231.  
  232.         RESTRICTIONS
  233.  
  234.         The object file is limited to 32k.  This includes comments and 
  235.         spaces.
  236.  
  237.         Symbols (including any addons from + and -) are limited to 32 
  238.         characters.
  239.  
  240.         Labels may be used in jump statements only and not as data 
  241.         references.  While there is a DB pseudo-opcode, it is not very 
  242.         useful with this restriction.
  243.  
  244.         The number of statement